package com.example.springbootquartz;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.net.InetAddress;

@Slf4j
@SpringBootApplication
@MapperScan("com.example.springbootquartz.dao")
public class SpringbootQuartzApplication {

    @SneakyThrows
    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(SpringbootQuartzApplication.class);
        ConfigurableApplicationContext application = app.run(args);
        Environment env = application.getEnvironment();
        //final String contextPath = env.getProperty("server.servlet.context-path");
        log.info("\r\n----------------------------------------------------------" +
                        "\r\nApplication is running! Access URLs:" +
                        "\r\ntDoc: http://{}:{}/doc.html " +
                        "\r\n----------------------------------------------------------",
                InetAddress.getLocalHost().getHostAddress(),
                env.getProperty("server.port"));
    }

}
